package com.pt25.study.example.domain.sharding.service.impl;


import com.pt25.study.example.domain.sharding.ddo.ShardingTest;
import com.pt25.study.example.domain.sharding.factory.ShardingFactory;
import com.pt25.study.example.domain.sharding.service.ShardingTestService;
import com.pt25.study.example.repository.sharding.persistence.ShardingTestRepo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class ShardingTestServiceImpl implements ShardingTestService {

    @Resource
    private ShardingFactory shardingFactory;

    @Resource
    private ShardingTestRepo shardingTestRepo;

    @Override
    public ShardingTest getShardingTest(Long id) {
        return shardingTestRepo.getShardingTest(id);
    }

    @Override
    public void addShardingTest(ShardingTest shardingTest) {
        shardingTestRepo.save(shardingFactory.ShardingTest2ShardingTestPo(shardingTest));
    }
}
